package Thread;
//class MyThread extends  Thread{
//    @Override
//    public void run() {
//        for (int i =0;i<3;i++){
//            System.out.println("这是在使用isAlive方法 hallo t");
//            try {
//                Thread.sleep(3000);
//            } catch (InterruptedException e) {
//                throw new RuntimeException(e);
//            }
//        }
//    }
//}
public class Demo7 {
    public static void main(String[] args) {
//       Thread t = new MyThread();
//        t.start();
        Thread t = new Thread(()->{
           for (int i=0;i<3;i++){
               System.out.println("这是在是Alive方法 hello t");
               try {
                   Thread.sleep(3000);
               } catch (InterruptedException e) {
                   throw new RuntimeException(e);
               }
           }
        });
         //这个结果一定是false
       // 此时还没有调用 start,没有真正的创建线程
        System.out.println(t.isAlive());
        t.start();
        while (true){
            System.out.println(t.isAlive());
            try {
                Thread.sleep(3000);
            } catch (InterruptedException e) {
                throw new RuntimeException(e);
            }
        }
    }
}
